package cn.mazexal.examapi.models.enums;

import lombok.Getter;

@Getter
public enum FromTypeEnum {
    // 1系统赠送 2后台赠送 3购买 4分享 5邀请 6其他

    SYSTEM_GIFT(1, "系统赠送"),
    BACKEND_GIFT(2, "后台赠送"),
    BUY(3, "购买"),
    SHARE(4, "分享"),
    INVITE(5, "邀请"),
    OTHER(6, "其他"),
    REFUND(7, "退款取消"),
    RESUME(8, "续订");
    private Integer value;
    private String name;

    FromTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static FromTypeEnum toEnum(int value) {
        for (FromTypeEnum item : FromTypeEnum.values()) {
            if (item.value.equals(value)) {
                return item;
            }
        }
        return null;
    }
}
